#include "Comm.hpp"

int main()
{
    //打开文件
    int wfd = open(Path, O_WRONLY);
    if(wfd < 0)
    {
        cout << "open fail, errno: " << errno << " stringerrno: " << strerror(errno) << endl;
        return 1;
    }
    string buffer;
    while(true)
    {
        cout << "Please message# ";
        getline(cin, buffer);
        ssize_t n = write(wfd, buffer.c_str(), buffer.size());
        if(n < 0)
        {
            cout << "write fail, errno: " << errno << " stringerrno: " << strerror(errno) << endl;
            break;
        }
    }

    close(wfd);//关闭文件
    return 0;
}